<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>var romanToInt = function(s) {
        var k = parseInt(s/1000)
        var h = parseInt(s%1000/100)
        var t = parseInt(s%100/10)
        var z = parseInt(s%10)
        var answer = ''
        for(var i =0;i<k;i++){
            answer = answer+'M'
        }
        if(h>=5&&h<9){
            answer=answer+"D"
        }
        else if(h==9){
            answer = answer+"CM"
            h=0
        }
        else if(h==4){
            answer = answer+"CD"
            h=0
        }
        for(var i = 0;i<h%5;i++){
            answer = answer+'C'
        }
        if(t>=5&&t<9){
            answer=answer+"L"
        }
        else if(t==9){
            answer = answer+"LC"
            t=0
        }
        else if(t==4){
            answer = answer+"XL"
            t=0
        }
        for(var i = 0;i<t%5;i++){
            answer = answer+'X'
        }
        if(z>=5&&z<9){
            answer=answer+"V"
        }
        else if(z==9){
            answer = answer+"IX"
            z=0
        }
        else if(z==4){
            answer = answer+"IV"
            z=0
        }
        for(var i = 0;i<z%5;i++){
            answer = answer+'I'
        }
       return answer
    };
    romanToInt(4496)
    </script>
</body>
</html>